Skip to content

feat: add ShopifyProvider to skeleton for locale-aware Money formatting#3722

Draft
fredericoo wants to merge 4 commits intomainfrom
fb-skeleton-shopify-provider
Draft

feat: add ShopifyProvider to skeleton for locale-aware Money formatting#3722
fredericoo wants to merge 4 commits intomainfrom
fb-skeleton-shopify-provider

Conversation

@fredericoo
Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Fixes #3432

Money from @shopify/hydrogen is a re-export of @shopify/hydrogen-react's Money, which depends on ShopifyProvider context for correct locale formatting via Intl.NumberFormat. Without ShopifyProvider in the tree, useShop() returns a hardcoded default context (countryIsoCode: 'US', languageIsoCode: 'EN'), causing all monetary values to format as en-US regardless of the store's configured locale.

WHAT is this pull request doing?

@shopify/hydrogen package:

  • Re-exports ShopifyProvider, useShop, and SFAPI_VERSION from @shopify/hydrogen-react so these can be imported without reaching into @shopify/hydrogen-react directly
  • Adds readonly apiVersion to the Storefront object returned by createStorefrontClient, giving loaders access to the resolved Storefront API version

Skeleton template:

  • Wraps the App component with ShopifyProvider, fed by storefront.i18n from the root loader
  • Fixes the hardcoded <html lang="en"> to dynamically use the configured language

HOW to test your changes?

  1. Scaffold a new project from the skeleton template
  2. Configure i18n in app/lib/context.ts with a non-US locale (e.g., {language: 'FR', country: 'FR'})
  3. Use the Money component on any route
  4. Verify that money values format using the configured locale (e.g., 1 234,56 € for French) instead of always formatting as en-US

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or functional changes.
  • I've added tests to cover my changes
  • I've added or updated the documentation

🤖 Generated with Claude Code

…ting

The Money component (re-exported from @shopify/hydrogen-react) depends on
ShopifyProvider context for correct locale formatting via Intl.NumberFormat.
Without it, all monetary values default to en-US regardless of the store's
configured locale.

This commit:
- Re-exports ShopifyProvider, useShop, and SFAPI_VERSION from @Shopify/hydrogen
- Adds readonly apiVersion to the Storefront object for clean server-to-client
  data flow
- Wraps the skeleton App component with ShopifyProvider, fed by storefront.i18n
- Fixes the hardcoded <html lang="en"> to use the configured language

Fixes #3432

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shopify
Copy link
Copy Markdown
Contributor

shopify bot commented Apr 15, 2026

Oxygen deployed a preview of your fb-skeleton-shopify-provider branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment April 15, 2026 7:02 PM

Learn more about Hydrogen's GitHub integration.

@fredericoo fredericoo changed the title fix: add ShopifyProvider to skeleton for locale-aware Money formatting feat: add ShopifyProvider to skeleton for locale-aware Money formatting Apr 15, 2026
fredericoo and others added 3 commits April 15, 2026 19:01
The ShopifyProvider wrapping in root.tsx changed the import line,
loader return, and JSX nesting structure. All 8 recipe patches
targeting root.tsx needed regeneration via three-way merge against
the updated skeleton.

Affected recipes: b2b, express, gtm, legacy-customer-account-flow,
markets, metaobjects, multipass, partytown.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ShopifyProvider validates that storeDomain and storefrontToken are
truthy. In mock.shop dev environments, these env vars are not set
(only SESSION_SECRET is), causing the dev server to throw a 500.

Providing fallbacks ('mock.shop' and 'mock') prevents the error
while keeping the provider functional for real Shopify stores.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pectations

The legacy-customer-account-flow recipe patch had a duplicated
`{headers}, );` block from the three-way merge, producing a syntax
error when applied. Removed the duplicate.

The markets E2E test expected prices formatted as en-US (`CA$1,121.00`)
because the old skeleton lacked ShopifyProvider. Now that ShopifyProvider
correctly passes the store's i18n data, the Money component formats
using the actual locale — fr-CA in this case (`1 121,00 $`). Updated
CURRENCY_FORMATS to distinguish CAD_EN from CAD_FR and pointed the
FR-CA locale tests at the correct format.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Money from @shopify/hydrogen is a re-export of Hydrogen React Money and requires ShopifyProvider for correct locale formatting

1 participant